<script setup lang="ts">
import { useSiteInfoStore } from '@/store/modules/earlyWarning/useSiteInfoStore';
import siteInfoTable from '@/components/siteInfoTable/index.vue';

const { toggleSiteEntities } = useSiteInfoStore();
const { siteInfoData } = storeToRefs(useSiteInfoStore());
</script>

<template>
  <el-row :gutter="20" class="site-box">
    <el-col :span="12" v-for="item in siteInfoData" :key="item.id">
      <div class="site-item-box" @click="toggleSiteEntities(item)">
        <div :class="['site-item-icon-box', item.clickStatus && 'active']">{{ item.value }}</div>
        <div class="site-item-text-box">{{ item.name }}</div>
      </div>
    </el-col>
  </el-row>
  <siteInfoTable />
</template>

<style scoped lang="scss">
.site-box {
  width: 100%;
  height: 100%;
}

.site-item-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.1rem; // 添加一些内边距
  color: white;

  .site-item-icon-box {
    width: 6.25rem;
    height: 5.6056rem;
    text-align: center;
    line-height: 1.875rem;
    background: url(@/assets/largescreen/station-icon.png) no-repeat center center;
    background-size: 100% 100%;
    font-size: 1.25rem;
    font-family: YouSheYaHei;
    font-weight: 700;
    cursor: pointer;
  }

  .site-item-text-box {
    margin-top: 0.1rem;
  }

  .active {
    background: url(@/assets/largescreen/Selected-station.png) no-repeat center center;
    background-size: 100% 100%;
  }
}
</style>
